package hutech.ksv.view;

import java.io.IOException;
import java.io.Serializable;

import javax.faces.context.FacesContext;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope("request")
public class WelcomeManagedBean implements Serializable {

	@Autowired
	UserLoginManagedBean userLoginManagedBean;
	
	public void onLoad() {
		if(userLoginManagedBean.userAccountHashtable == null) {
			try {
				FacesContext.getCurrentInstance().getExternalContext().redirect("UserLogin.xhtml");
			} catch (IOException e) {
				e.printStackTrace();
				System.out.println(e.getMessage());
			}
		}		
	}
	
	//Khai bao cac properties
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

}
